package com.ishell.generate.util;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;

/**
 * 作者: crazier.huang
 * 项目: generate
 * 日期: 2018/6/8 星期五
 * 说明:
 */
public class Streams {

    /**
     * inputStream 
     * @param in
     * @return
     * @throws IOException
     */
    public static byte[] readBytes(InputStream in) throws IOException {
        ByteArrayOutputStream swapStream = new ByteArrayOutputStream();
        byte[] buffer = new byte[1024];
        int rc;
        while ((rc = in.read(buffer,0,1024))>0){
            swapStream.write(buffer);
        }
        byte[] in2b = swapStream.toByteArray();
        return in2b;
    }
}
